package cc.vv.btpartyjob.partymanager.adapter

import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter
import android.view.ViewGroup

/**
 * viewPager适配器
 * Created by Chen.qi on 2018/10/27.
 */
class ManagerViewPageAdapter : FragmentPagerAdapter {

    /**
     * Fragment数据集
     */
    private var mFragments: ArrayList<Fragment>? = null

    constructor(fm: FragmentManager, mFragments: ArrayList<Fragment>) : super(fm) {
        this.mFragments = mFragments
    }

    override fun getItem(position: Int): Fragment {
        return mFragments!![position]
    }

    override fun getCount(): Int {
        return mFragments!!.size
    }

    override fun finishUpdate(container: ViewGroup?) {
        container!!.invalidate()
        super.finishUpdate(container)
    }
}